﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;

public partial class SuperPong : Game
{

    void handleMainMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                gameState = SuperPongControl.Types.GameState.NUM_PLAYER_SCREEN;
                break;
            case 1:
                this.Exit();
                //gameState = SuperPongControl.Types.GameState.INSTRUCTIONS;
                //this.instructionsopentime = (float)gameTime.TotalGameTime.Milliseconds / 1000f + (float)gameTime.TotalGameTime.Seconds + gameTime.TotalGameTime.Minutes * 60f + gameTime.TotalGameTime.Hours * 3600f;
                break;
            case 2:
                this.Exit();
                //gameState = SuperPongControl.Types.GameState.CREDITS;
                //this.creditopentime = (float)gameTime.TotalGameTime.Milliseconds / 1000f + (float)gameTime.TotalGameTime.Seconds + gameTime.TotalGameTime.Minutes * 60f + gameTime.TotalGameTime.Hours * 3600f;
                break;
            case 3:
                this.Exit();
                break;
            default:
                break;
        }
    }

    void handleBackMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                gameState = SuperPongControl.Types.GameState.MAIN_MENU;
                break;
            default:
                break;
        }
    }

    void handleBackMenu2(int choice)
    {
        switch (choice)
        {
            case 0:
                gameState = SuperPongControl.Types.GameState.GAME_TYPE;
                break;
            default:
                break;
        }
    }

    void handleBackMenu3(int choice)
    {
        switch (choice)
        {
            case 0:
                gameState = SuperPongControl.Types.GameState.NUM_PLAYER_SCREEN;
                break;
            default:
                break;
        }
    }
    void handleBackMenu4(int choice)
    {
        switch (choice)
        {
            case 0:
                gameState = SuperPongControl.Types.GameState.LIFE_SELECTION_SCREEN;
                break;
            default:
                break;
        }
    }

    void handleNumPlayersMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                this.numPlayers = 2;
                this.Players[1].isCPU = true;
                this.gameState = SuperPongControl.Types.GameState.LIFE_SELECTION_SCREEN;
                break;
            case 1:
                this.numPlayers = 2;
                this.Players[1].isCPU = false;
                this.gameState = SuperPongControl.Types.GameState.LIFE_SELECTION_SCREEN;
                break;
            default:
                break;
        }
    }

    void handleLifeSelectMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                this.numLives = 3;
                this.gameState = SuperPongControl.Types.GameState.DIFFICULTY_SCREEN;
                if (!this.Players[1].isCPU)
                {
                    InitializeGame();
                }
                break;
            case 1:
                this.numLives = 5;
                this.gameState = SuperPongControl.Types.GameState.DIFFICULTY_SCREEN;
                if (!this.Players[1].isCPU)
                {
                    InitializeGame();
                }
                break;
            case 2:
                this.numLives = 10;
                this.gameState = SuperPongControl.Types.GameState.DIFFICULTY_SCREEN;
                if (!this.Players[1].isCPU)
                {
                    InitializeGame();
                }
                break;
            case 3:
                this.numLives = 15;
                this.gameState = SuperPongControl.Types.GameState.DIFFICULTY_SCREEN;
                if (!this.Players[1].isCPU)
                {
                    InitializeGame();
                }
                break;
            default:
                break;
        }
    }

    void handleDifficultyMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                this.Difficulty = 10;
                Players[1].setDifficulty(Difficulty);
                InitializeGame();
                break;
            case 1:
                this.Difficulty = 5;
                Players[1].setDifficulty(Difficulty);
                InitializeGame();
                break;
            case 2:
                this.Difficulty = 3;
                Players[1].setDifficulty(Difficulty);
                InitializeGame();
                break;
            case 3:
                this.Difficulty = 2;
                Players[1].setDifficulty(Difficulty);
                InitializeGame();
                break;
            case 4:
                this.Difficulty = 1;
                Players[1].setDifficulty(Difficulty);
                InitializeGame();
                break;
            default:
                break;
        }
    }


    void handleGameEndMenu(int choice)
    {
        switch (choice)
        {
            case 0:
                InitializeGame();
                this.gameState = SuperPongControl.Types.GameState.GAME_RUNNING;
                break;
            case 1:
                this.gameState = SuperPongControl.Types.GameState.MAIN_MENU;
                break;
        }
    }
}